<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<title>表单提交时验证 - jQuery EasyUI 演示</title>
	<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
	<link rel="stylesheet" type="text/css" href="../../themes/default/easyui.css">
	<link rel="stylesheet" type="text/css" href="../../themes/icon.css">
	<link rel="stylesheet" type="text/css" href="../demo.css">
	<script type="text/javascript" src="../../jquery.min.js"></script>
	<script type="text/javascript" src="../../jquery.easyui.min.js"></script>
	<script type="text/javascript" src="../../locale/easyui-lang-zh_CN.js"></script>
</head>
<body>
	<h2 title="Validate Form on Submit">表单提交时验证</h2>
	<p title="The form does not perform validation before being submitted.">　　表单在提交前是不会执行验证操作的。</p>
	<div style="margin:10px 0;"></div>
	<div class="easyui-panel" title="<h title='New Topic'>&nbsp;发表新帖</h>" style="width:100%;max-width:400px;padding:10px 20px;">
		<form id="ff" class="easyui-form" method="post" data-options="novalidate:true">
			<div style="margin-bottom:10px">
				<input class="easyui-textbox" name="name" style="width:100%" data-options="label:'姓名：',labelWidth:50,required:true">
			</div>
			<div style="margin-bottom:10px">
				<input class="easyui-textbox" name="email" style="width:100%" data-options="label:'邮箱：',labelWidth:50,required:true,validType:'email'">
			</div>
			<div style="margin-bottom:10px">
				<input class="easyui-textbox" name="subject" style="width:100%" data-options="label:'标题：',labelWidth:50,required:true">
			</div>
			<div style="margin-bottom:10px">
				<input class="easyui-textbox" name="message" style="width:100%;height:60px" data-options="label:'<br/>内容：',labelWidth:50,multiline:true">
			</div>
			<div style="margin-bottom:10px">
				<select class="easyui-combobox" name="language" style="width:100%" data-options="label:'语言：',labelWidth:50,editable:false"><option value="ar">Arabic 阿拉伯语</option><option value="bg">Bulgarian 保加利亚语</option><option value="ca">Catalan 加泰罗尼亚语</option><option value="zh-chs" selected="selected">Chinese Simplified 简体中文</option><option value="zh-cht">Chinese Traditional 繁體中文</option><option value="cs">Czech 捷克语</option><option value="da">Danish 丹麦语</option><option value="nl">Dutch 荷兰语</option><option value="en">English 英语</option><option value="et">Estonian 爱沙尼亚</option><option value="fi">Finnish 芬兰语</option><option value="fr">French 法语</option><option value="de">German 德语</option><option value="el">Greek 希腊语</option><option value="ht">Haitian Creole 海地克里奥尔语</option><option value="he">Hebrew 希伯来语</option><option value="hi">Hindi 印地语</option><option value="mww">Hmong Daw 苗语</option><option value="hu">Hungarian 匈牙利语</option><option value="id">Indonesian 印度尼西亚语</option><option value="it">Italian 意大利语</option><option value="ja">Japanese 日语</option><option value="ko">Korean 朝鲜语</option><option value="lv">Latvian 拉脱维亚语</option><option value="lt">Lithuanian 立陶宛语</option><option value="no">Norwegian 挪威语</option><option value="fa">Persian 波斯语</option><option value="pl">Polish 波兰语</option><option value="pt">Portuguese 葡萄牙语</option><option value="ro">Romanian 罗马尼亚语</option><option value="ru">Russian 俄语</option><option value="sk">Slovak 斯洛伐克语</option><option value="sl">Slovenian 斯洛文尼亚语</option><option value="es">Spanish 西班牙语</option><option value="sv">Swedish 瑞典语</option><option value="th">Thai 泰国语</option><option value="tr">Turkish 土耳其语</option><option value="uk">Ukrainian 乌克兰语</option><option value="vi">Vietnamese 越南语</option></select>
			</div>
		</form>
		<div style="text-align:center;padding:5px 0">
			<a href="javascript:void(0)" class="easyui-linkbutton" onclick="submitForm()" style="width:80px">提交</a>
			<a href="javascript:void(0)" class="easyui-linkbutton" onclick="clearForm()" style="width:80px">清空</a>
		</div>
	</div>
	<script>
		function submitForm(){
			$('#ff').form('submit',{
				onSubmit:function(){
					return $(this).form('enableValidation').form('validate');
				}
			});
		}
		function clearForm(){
			$('#ff').form('clear');
		}
	</script>
</body>
</html>